package com.ymatou.iapi.godmch.service;

import java.util.List;

import net.sf.json.JSONObject;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.ymatou.iapi.godmch.parameter.PercentageItem;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*代理价按条件加价规则详情Call
*FreeMaker Template自动生成代码
*/
public class getAgentConditionMarkupConfigDetailCall extends YmatouBaseCall{
	private static String opurl ="api/agent/getAgentConditionMarkupConfigDetail";
	
	public getAgentConditionMarkupConfigDetailCall() {
		super(EnvSetup.getSystemUrl("godmch_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	
	 public String getStatusCode1()
	 {
	  return getString("status");
	 }
	
	 public String getMessage()
	 {
	 return getString("msg");
	 }
		
	 public JSONObject getResult()
	 {
	  return JSONObject.fromObject(getString("result"));
	 }
	 
	public List<PercentageItem> getPercentageList()
	{
		Gson gson = new Gson();
		
		List<PercentageItem> percentageList = gson.fromJson( JSONObject.fromObject(getString("result")).getString("percentageList"),
				new TypeToken<List<PercentageItem>>() { }.getType());//对于不是类的情况，用这个参数给出 
		
		return percentageList;
	}
}